package net.pulseproject.commons.misc.preferences;

import java.awt.Point;

import net.pulseproject.commons.util.StringConverterUtil;

class PreferencesPointField extends PreferencesConvertableField<Point> {
	
	private static final PointConverter CONVERTER = new PointConverter();
	
	public PreferencesPointField(final String key, final Point defaultValue) {
		super(key, defaultValue, CONVERTER);
	}

	private static class PointConverter implements Converter<Point> {
		@Override
		public String format(final Point instance) {
			return StringConverterUtil.formatPointRaw(instance);
		}

		@Override
		public Point parse(final String rawString) {
			return StringConverterUtil.parseRawPoint(rawString);
		}
	}
}
